package com.hanxin.controller;

import com.hanxin.pojo.*;
import com.hanxin.service.SpecialService;
import com.hanxin.utils.EditJkf;
import com.hanxin.utils.InformationDto;
import com.hanxin.utils.InsertJkf;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

@RestController
@Api(tags = "特殊加扣分申请信息")
@RequestMapping("/specialApplication")
public class SpecialController {
    @Autowired
    private SpecialService specialService;


    @PostMapping("/selectAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请信息查询")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> selectAddAuthstr(@RequestBody InformationDto informationDto){
        System.out.println(informationDto);
        return specialService.test(informationDto);
    }

    @PostMapping("/deleteAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请删除")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> deleteAddAuthstr(@RequestBody  List<Integer> ids){
        System.out.println("ids:--------------------"+ids);
        return specialService.deleteByIds(ids);
    }

    @PostMapping("/updateSubAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请提交")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> updateSubAddAuthstr(@RequestBody  List<Integer> ids){
        System.out.println("ids:--------------------"+ids);
        return specialService.updateByids(ids);
    }

    @PostMapping("/updatezSubAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请撤回提交")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> updatezSubAddAuthstr(@RequestBody  List<Integer> ids){
        System.out.println("ids:--------------------"+ids);
        return specialService.updatezByids(ids);
    }

    @PostMapping("/insertSubAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请新增")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> insertSubAddAuthstr(@RequestBody InsertJkf insertJkf){
        return specialService.insertJkf(insertJkf);
    }

    @PostMapping("/editGetAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请编辑缓存查询数据显示在页面上")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> editGetAddAuthstr(@RequestBody EditJkf editId){
        return specialService.editGetJkf(editId);
    }

    @PostMapping("/editAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请编辑")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> editAddAuthstr(@RequestBody EditJkf editJkf){
        return specialService.editJkf(editJkf);
    }

    @PostMapping("/editCheckAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请编辑没有缓存查看")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> editCheckAddAuthstr(@RequestBody EditJkf editJkf){
        return specialService.editCheckJkf(editJkf);
    }


    @PostMapping("/cancelAddAuthstr")
    @ApiOperation(value = "特殊加扣分申请编辑缓存")
    @ApiResponses({ @ApiResponse(code = 200, message = "请求成功", response = TAudit.class),
            @ApiResponse(code = 404, message = "信息不存在") })
    @ResponseBody
    @CrossOrigin
    public Result<Object> cancelAddAuthstr(@RequestBody EditJkf editJkf){
        return specialService.cancelJkf(editJkf);
    }



}